var leftObj,rightObj;
window.onload = function () {
    leftObj = document.getElementById("leftSelect");
    rightObj = document.getElementById("rightSelect");
}

function toRight() {
    for(var i = 0; i < leftObj.selectedOptions.length;){
        rightObj.appendChild(leftObj.selectedOptions[i]);
    }
}
function toRightAll() {
    var leftArray = leftObj.getElementsByTagName("option");
    for(var i = 0; i < leftArray.length;){
        rightObj.appendChild(leftArray[i]);
    }
}
function toLeft() {
    for(var i = 0; i < rightObj.selectedOptions.length;){
        leftObj.appendChild(rightObj.selectedOptions[i]);
    }
}
function toLeftAll() {
    var rightArray = rightObj.getElementsByTagName("option");
    for(var i = 0; i < rightArray.length;){
        leftObj.appendChild(rightArray[i]);
    }
}